package com.recursion;

/**
 * @BelongsProject: DataStructures
 * @BelongsPackage: com.recursion
 * @Author: 江岸
 * @CreateTime: 2021-01-24 17:59
 * @Description: 递归测试
 */
public class RecursionTest {

    public static void main(String[] args) {
        System.out.println(fun(4));
    }

    //计算阶乘
    static public int fun(int n) {
        if (n == 1) {
            return 1;
        } else {
            return fun(n - 1) * n;
        }
    }
}
